package com.kl.common.jxl;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;

/**
 * 
 * 数据转换
 * 
 * @author H.x
 * 
 */
public class DataConvert {

	/**
	 * inStream 转换 byte
	 * 
	 * @param inStream
	 * @return
	 * @throws Exception
	 */
	public static byte[] inputStreamToBytes(InputStream inStream) {
		byte[] bytes = null;
		try {
			ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
			byte[] buff = new byte[100];
			int rc = 0;
			while ((rc = inStream.read(buff, 0, 100)) > 0) {
				swapStream.write(buff, 0, rc);
			}
			bytes = swapStream.toByteArray();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return bytes;
	}
}
